package com.thinkmore.mybatisplus.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.thinkmore.bean.dto.MpUserDto;
import com.thinkmore.mybatisplus.entity.MpUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author tudou
 * @since 2019-12-08
 */
public interface MpUserMapper extends BaseMapper<MpUser> {
    @Select("select * from user ${ew.customSqlSegment}")
    List<MpUser> customSql(@Param(Constants.WRAPPER) Wrapper<MpUser> wrapper);

    @Select("select u.* from user u inner join role r on r.id=u.fk_role_id ${ew.customSqlSegment}")
    List<MpUser> customSql2(@Param(Constants.WRAPPER) Wrapper<MpUser> wrapper);

    List<MpUser> customSql3(@Param(Constants.WRAPPER) Wrapper<MpUser> wrapper);

    Page<MpUser> myPage(Page<MpUser> page, @Param(Constants.WRAPPER) Wrapper<MpUser> wrapper);

    Page<MpUser> selectMyPage(Page<MpUser> page, @Param("userDto") MpUserDto userDto);

    MpUser customSql4(@Param("type") String type, @Param("id") String id);

    MpUser customSql5(@Param("type") String type, @Param("id") String id);
}
